All Questions
56 questions
0votes
2answers
661views
Stuck at CS50 Python Week2 pset question "Vanity Plates" - Not sure what went wrong in my code
I just started learning python using the CS50 course today, and after I made it to week2 practice set I am stuck with this question "Vanity Plates". I have no background in coding before ...
0votes
1answer
178views
c programming grocery calculator
float calculateTotalCost(float*itemCosts, int itemCount); int main() { int itemCount = 0; float itemCosts[50]; char itemName[50]; char choice; printf("Welcome to Grocery Shop\...
0votes
0answers
45views
Making loops into functions so the GUI can search and respond to change text with results
I am trying to search through a list of elements and return values that were not provided. So far i can get it to work as a basic computer program, but I am having trouble integrating it to tkinter. I ...
0votes
2answers
54views
how can I avoid the "Enter your name" message show up again?
Basically when the employee_action function is called, and the user presses 1 or 2 and the data is printed to the terminal, after the user presses enter the message "enter your name" shows ...
0votes
1answer
36views
Cant get the grids to line up
I was making a number sliding puzzle on Python using loops, The function takes in a sequence of strings separated by commas, the grids don't line up though and I don't know why. my program import math ...
1vote
3answers
144views
Functions and loops in C
How can I make this function odddigits to return each and every value the while and for loops calculates of the variable odd at every iteration for i? Thanks in advance. This worked fine when I the ...
0votes
3answers
52views
Create a function that takes each item in a list as argument iteratively
The challenge is to use Python to create a function that takes in sub-lists of a list and applies the strip function to each sub-list iteratively. After that it rebuilds the list with the cleaned sub-...
0votes
1answer
27views
Functions code running, but dont know how to call a certain function
This code is running, but not properly analyzing budget, prompting, or returning values correctly. I am having trouble writing the correct functions. When I run it, it prompts the user for their ...
-1votes
2answers
595views
C++ Newbie: Why don't these nested loops work for this program?
I'm in the middle of taking an online C++ course, and I've been having issues with this homework problem. I tried reaching out to my professor twice, but he hasn't responded. I've sought out many ...
-4votes
2answers
352views
Python While Loop with Function
My professor is asking for us to output the example on the left (word doc). My current code is on the right. He wants us to use a While/For loop in the code. I made the current code with only the 15% ...
0votes
1answer
97views
How can I prepend each value of a list with either a loop or a function?
I'm currently making API calls to an application and then parsing the JSON data for certain values. The values I'm parsing are suffixes of a full URL. I need to take this list of suffixes and prepend ...
1vote
0answers
123views
R:Create loop or function for Moran I per region
I am new to this platform, so I hope I can make my problem clear as possible. I have a dataset all_regions with the following column variables: all_regions$region, all_regions$participantID, ...
0votes
0answers
30views
Need help in understanding why for loop didn't iterate whole list, yet while did
I'm just beginning Python and I wanted to write some functions based on an exercise, and then call these functions from another function, all to extract first letters from each word in a string. At ...
0votes
1answer
1kviews
How to count characters in a C_String in C++?
I'm a new Computer Science student, and I have a homework question that is as follows: Write a Function that passes in a C-String and using a pointer determine the number of chars in the string. ...
-1votes
3answers
2kviews
how can I get the function to return index of 2 numbers that add up to a target value
I am writing a function to take a list of integers and an integer called target and return the indices of the two numbers in the list such that they add up to target. But my code doesn't work the way ...